package com.mqy.spring.AOP;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

/**
 * @author 13159 //作者
 * @version V1.0 //版本
 * @Project 2022.3.4SpringProxy
 * @Package com.mqy.spring.AOP
 * @Description:
 * @Date 2022/3/5 16:27//日期
 * @Motto:放下杂念,只为迎接明天更好的自己
 */

/*在目标之前执行*/

public class MyMethodBeforeAdvice  implements MethodBeforeAdvice, AfterReturningAdvice {
    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
System.out.println("---开启事务---MyMethodBeforeAdvice中的方法before执行了");
    }

    @Override
    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        System.out.println("---提交事务---MyMethodBeforeAdvice中的方法afterReturning执行了");
    }



}
